package cn.edu.gdu.quizpractice.service.impl;

import cn.edu.gdu.quizpractice.dao.ManagerDao;
import cn.edu.gdu.quizpractice.entity.Manager;
import cn.edu.gdu.quizpractice.service.IManagerService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

/**
 * @Author: Aubery
 * @Date: 2025-01-19-15:08
 * @Description:
 */

@Service
public class ManagerServiceImpl extends ServiceImpl<ManagerDao, Manager> implements IManagerService {

    @Qualifier("managerDao")
    @Autowired
    private ManagerDao managerDao;

    @Override
    public Manager findByTeleAndPassword(String telephone, String password) {
        return findByTeleAndPassword(telephone, password);
    }

    @Override
    public List<Manager> findAll() {
        return managerDao.findAll();
    }

    @Override
    public Optional<Manager> findByTele(String telephone) {
        return managerDao.findByTele(telephone);
    }

    @Override
    public boolean updateByTele(Manager manager) {
        return managerDao.updateByTele(manager);
    }

    @Override
    public boolean removeByTele(String telephone) {
        return managerDao.deleteByTele(telephone);
    }

    @Override
    public boolean updatePwd(String telephone, String password) {
        return managerDao.updatePwd(telephone, password);
    }

    @Override
    public String findPwdByTele(String telephone) {
        return managerDao.findPwdByTele(telephone);
    }

    @Override
    public boolean updateEmail(String telephone, String email) {
        return managerDao.updateEmail(telephone, email);
    }

    @Override
    public boolean save(Manager entity) {
        return managerDao.add(entity);
    }
}
